<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>

<body>
  <div id="app">
    <!-- xss：前端的脚本注入 -->
    <div v-html="message">
    </div>
    <div v-bind:id="divid" >
      {{message}}
    </div>
    <div>
      {{ 1+2+3 }}
      <br>
      {{true?"helloworld":"taiyuan2002"}}
      <br>
      <!-- 错误的代码 -->
      <!-- {{console.log(1)}} -->
      <br>
      v-if: 
      <h1 v-if="isshow">{{message}}</h1>
      <br>
      <a :href="url">baidu</a>
      <br>
      <a v-bind:[attrname]="val">网易</a>

      <!-- <button v-on:click="msg()">按钮</button> -->
      <button @click="msg()">按钮</button>
    </div>
  </div>

  <script>

    var vm = new Vue({
      //选项
      el: "#app",
      //响应式的数据
      data: {
        // message: `<h1>太原2002</h1><a href="javascript:alert(document.cookie)">link</a> `,
        message:"hellworld",
        divid:"main",
        isshow:true,
        url:"https://www.baidu.com",
        attrname:"id",
        val:"163.com"
      },
      methods:{
        msg(){
          alert('helloworld')
        }
      }
    })

  </script>
</body>

</html>